package com.sduept.nwld.dataserver.util;

import java.util.Comparator;

import com.sduept.bigdata.fault.entity.FaultReportComponentDetail;

public class ActionDetailsComponetComparator implements Comparator<FaultReportComponentDetail>{

	@Override
	public int compare(FaultReportComponentDetail arg0,
			FaultReportComponentDetail arg1) {
		long rtn = arg0.getActionTime()-arg1.getActionTime();
		if(arg0.getmEventStartTime()==null&&arg0.getmStartMs()==null&&arg1.getmEventStartTime()==null&&arg1.getmStartMs()==null) {
			//如果开始时间和开始毫秒为空，默认返回 相对时间
		}else {
			try {
				rtn = arg0.getmEventStartTime().getTime()-arg1.getmEventStartTime().getTime();
				if(rtn == 0) {
					rtn = arg0.getmStartMs()-arg1.getmStartMs();
					if(rtn == 0) {
						 rtn = arg0.getActionTime()-arg1.getActionTime();
					}
				}
			}catch(Exception e) {
				//默认返回 相对时间
			}
		}
		return (int)rtn;
	}

}
